package app.view.component
{
	import flash.events.MouseEvent;
	
	import mx.containers.Canvas;
	import mx.core.DragSource;
	import mx.managers.DragManager;

	public class DragTarget extends Canvas
	{
		public function DragTarget(){
			activate();
		}
		
		public function activate():void{
			buttonMode = true;
			addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
		}
		
		public function deactivate():void{
			buttonMode = false;
			removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
		}
		
		private function onMouseDown(event:MouseEvent):void{
			var dragSource:DragSource = new DragSource(),
				imageProxy:Canvas = new Canvas();
			dragSource.addData(data, "dragTarget");               
			imageProxy.height=16;
 			imageProxy.width=16; 
 			imageProxy.setStyle("backgroundColor", 0xff0000)           
    		DragManager.doDrag(this, dragSource, event, 
                    imageProxy);

		}
		
	}
}